# -*- encoding=UTF-8 -*-
import json
import os
import random
import time
from datetime import datetime
from time import sleep

import requests
import uiautomator2 as u2
from PIL import Image, ImageStat


d = u2.connect_usb("R5CR11R7GBZ")

list = ["com.wyze.gemini:id/gm_img_live_floodlight","com.wyze.gemini:id/gm_img_live_mic","com.wyze.gemini:id/gm_ll_live_siren"]

while True:
    try:
        resourceid = random.randint(0, 2)

        d(resourceId=list[resourceid]).click(timeout=5)

        sleep(1)

        # d(resourceId="com.wyze.gemini:id/gm_img_live_mic").click(timeout=5)

        # sleep(0.1)
        #
        # d(resourceId="com.wyze.gemini:id/gm_ll_live_siren").click(timeout=5)
        #
        # sleep(0.1)

        # d(resourceId="com.wyze.gemini:id/gm_img_live_mic").click(timeout=5)
        #
        # sleep(0.1)

        pass
    except Exception as e:
        print(e)
